var t = getApp();

Page({
    data: {
        popupShow: !0,
        goods_name: "",
        page: 1,
        finished: !1,
        listData: [],
        explain: ""
    },
    onLoad: function(t) {
        this.getData();
    },
    onShow: function() {},
    onReachBottom: function() {
        this.getData();
    },
    getData: function() {
        var a = this;
        if (!this.data.finished) {
            var e = t.getNetAddresss("plugin.stock-service.frontend.controllers.home.stock");
            t._getNetWork({
                url: e,
                data: {
                    page: this.data.page,
                    goods_name: this.data.goods_name
                },
                success: function(t) {
                    if (1 !== t.data.result) return wx.showToast({
                        title: t.data.msg
                    }), !1;
                    var e, i = t.data.data, s = !1;
                    wx.setNavigationBarTitle({
                        title: i.name
                    }), a.setData({
                        explain: i.explain
                    }), (0 === i.list.data.length || i.list.data.length < i.list.per_page || i.list.current_page === i.list.last_page) && (s = !0), 
                    e = a.data.listData.concat(i.list.data), a.setData({
                        finished: s,
                        listData: e,
                        page: ++a.data.page
                    });
                }
            });
        }
    },
    clsoePopup: function() {
        this.setData({
            popupShow: !1
        });
    },
    onSearch: function(t) {
        this.setData({
            goods_name: t.detail,
            page: 1,
            finished: !1,
            listData: []
        }), this.getData();
    },
    goGoodsDetail: function(t) {
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + t.currentTarget.dataset.id
        });
    }
});